<html>
<head><meta charset="utf-8"><title>chatting · project-thir-unsafeck · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/index.html">project-thir-unsafeck</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html">chatting</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="227279713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227279713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227279713">(Feb 22 2021 at 15:05)</a>:</h4>
<p>Hey <span class="user-mention" data-user-id="255061">@Léo Lanteri Thauvin</span> :)</p>



<a name="227279749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227279749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227279749">(Feb 22 2021 at 15:05)</a>:</h4>
<p>so....let's see</p>



<a name="227279841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227279841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227279841">(Feb 22 2021 at 15:06)</a>:</h4>
<p>I've done a bit of research/tinkering on my part</p>



<a name="227279854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227279854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227279854">(Feb 22 2021 at 15:06)</a>:</h4>
<p>I guess I better start by pouring myself a mug of coffee <span aria-label="coffee" class="emoji emoji-2615" role="img" title="coffee">:coffee:</span></p>



<a name="227279863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227279863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227279863">(Feb 22 2021 at 15:06)</a>:</h4>
<p>awesome</p>



<a name="227279870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227279870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227279870">(Feb 22 2021 at 15:06)</a>:</h4>
<p>Had a few notes in <a href="https://hackmd.io/REEW4jiNRe2Al72r31CQIA?both">https://hackmd.io/REEW4jiNRe2Al72r31CQIA?both</a></p>



<a name="227279941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227279941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227279941">(Feb 22 2021 at 15:06)</a>:</h4>
<p>one thing I was wondering about -- I don't know at this point whether THIR is only created during MIR construction or if it is created beforehand anywhere</p>



<a name="227280004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280004">(Feb 22 2021 at 15:07)</a>:</h4>
<p>It's only created for MIR AFAICT</p>



<a name="227280084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280084">(Feb 22 2021 at 15:07)</a>:</h4>
<p>that was my expectation</p>



<a name="227280093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280093">(Feb 22 2021 at 15:07)</a>:</h4>
<p>we used to create it "lazilly"</p>



<a name="227280096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280096">(Feb 22 2021 at 15:07)</a>:</h4>
<p>I think we stopped doing that</p>



<a name="227280168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280168">(Feb 22 2021 at 15:08)</a>:</h4>
<p>Pattern checks don't even construct the whole THIR, they just visit the HIR and construct only the patterns</p>



<a name="227280198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280198">(Feb 22 2021 at 15:08)</a>:</h4>
<p>by lazilly, I mean that as MIR construction proceeded, we would build the THIR for one expression at a time</p>



<a name="227280271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280271">(Feb 22 2021 at 15:08)</a>:</h4>
<p>I wrote some code as I was thinking</p>



<a name="227280285"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280285" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280285">(Feb 22 2021 at 15:09)</a>:</h4>
<p>I'm looking over your hackmd</p>



<a name="227280320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280320">(Feb 22 2021 at 15:09)</a>:</h4>
<p>So I had a <code>check_expr</code> that just recurses</p>



<a name="227280353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280353">(Feb 22 2021 at 15:09)</a>:</h4>
<p>Mirroring the HIR into THIR as it progresses</p>



<a name="227280363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280363">(Feb 22 2021 at 15:09)</a>:</h4>
<p>As a first prototype</p>



<a name="227280465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280465">(Feb 22 2021 at 15:10)</a>:</h4>
<p>Hi <span class="user-mention silent" data-user-id="248906">cjgillot</span> :D</p>



<a name="227280542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280542">(Feb 22 2021 at 15:11)</a>:</h4>
<p>ok</p>



<a name="227280570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280570">(Feb 22 2021 at 15:11)</a>:</h4>
<p>where is the prototype?</p>



<a name="227280585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280585">(Feb 22 2021 at 15:11)</a>:</h4>
<p>I guess I'll drop some notes into the doc</p>



<a name="227280615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280615">(Feb 22 2021 at 15:11)</a>:</h4>
<p>I only have it locally</p>



<a name="227280652"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280652" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280652">(Feb 22 2021 at 15:11)</a>:</h4>
<p>Should I create a gist/integrate it in the hackmd?</p>



<a name="227280712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280712">(Feb 22 2021 at 15:12)</a>:</h4>
<p>I mean, it's not even a prototype since it doesn't work yet :)</p>



<a name="227280790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280790">(Feb 22 2021 at 15:12)</a>:</h4>
<p>sure, if you like</p>



<a name="227280805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280805">(Feb 22 2021 at 15:12)</a>:</h4>
<p>I'm also going to open up the code</p>



<a name="227280821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280821">(Feb 22 2021 at 15:12)</a>:</h4>
<p>I see you wrote out the unsafe operations</p>



<a name="227280830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280830">(Feb 22 2021 at 15:12)</a>:</h4>
<p>that's helpful, I was thinking that would be a good thing to do</p>



<a name="227280901"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227280901" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227280901">(Feb 22 2021 at 15:13)</a>:</h4>
<p>what is <code>InitializingTypeWith</code> ?</p>



<a name="227281028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281028">(Feb 22 2021 at 15:14)</a>:</h4>
<p>It's "initializing type with <code>rustc_layout_scalar_valid_range</code> attr"</p>



<a name="227281107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281107">(Feb 22 2021 at 15:14)</a>:</h4>
<p>oh, ok</p>



<a name="227281120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281120">(Feb 22 2021 at 15:14)</a>:</h4>
<p>hmm</p>



<a name="227281124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281124">(Feb 22 2021 at 15:14)</a>:</h4>
<p>we still have <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/thir/enum.BlockSafety.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/thir/enum.BlockSafety.html</a> :)</p>



<a name="227281131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281131">(Feb 22 2021 at 15:14)</a>:</h4>
<p>well, that answers some of your questions</p>



<a name="227281136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281136">(Feb 22 2021 at 15:14)</a>:</h4>
<p>(I like to refer to the implementation of <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/mir/enum.UnsafetyViolationDetails.html#method.description_and_note"><code>description_and_note</code></a>)</p>



<a name="227281164"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281164" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281164">(Feb 22 2021 at 15:14)</a>:</h4>
<p>most notably you cannot skip unsafe blocks</p>



<a name="227281236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281236">(Feb 22 2021 at 15:15)</a>:</h4>
<p>not sure if you're familiar with that block safety stuff, but it was introduced to allow us to do a kind of unsafety hygiene</p>



<a name="227281246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281246">(Feb 22 2021 at 15:15)</a>:</h4>
<p>it may not be used anymore</p>



<a name="227281261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281261">(Feb 22 2021 at 15:15)</a>:</h4>
<p>because the feature for which it was initially added was removed</p>



<a name="227281276"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281276" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281276">(Feb 22 2021 at 15:15)</a>:</h4>
<p>Oh</p>



<a name="227281307"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281307" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281307">(Feb 22 2021 at 15:15)</a>:</h4>
<p>What was it for? Curious now :)</p>



<a name="227281322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281322">(Feb 22 2021 at 15:15)</a>:</h4>
<p>the idea was that you could "push" and "pop" unsafe, so that you could go into an unsafe block and then back out again</p>



<a name="227281370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281370">(Feb 22 2021 at 15:16)</a>:</h4>
<p>it was used for the <code>a &lt;- b</code> operator</p>



<a name="227281400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281400">(Feb 22 2021 at 15:16)</a>:</h4>
<p>the desugaring thereof</p>



<a name="227281421"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281421" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281421">(Feb 22 2021 at 15:16)</a>:</h4>
<p>this was used to do in-place initialization</p>



<a name="227281429"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281429" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281429">(Feb 22 2021 at 15:16)</a>:</h4>
<p>e.g., <code>vec &lt;- element</code></p>



<a name="227281451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281451">(Feb 22 2021 at 15:16)</a>:</h4>
<p>was kind of equivalent to <code>vec.push(element)</code> except that it didn't make a temporary</p>



<a name="227281576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281576">(Feb 22 2021 at 15:17)</a>:</h4>
<p>Dropped my current code in the HackMD</p>



<a name="227281733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281733">(Feb 22 2021 at 15:18)</a>:</h4>
<p>Don't look at the <code>ControlFlow</code>s, I was just thinking about how I could handle early exits</p>



<a name="227281743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281743">(Feb 22 2021 at 15:18)</a>:</h4>
<p>I'd like to read a bit into how the THIR is constructed I guess</p>



<a name="227281761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281761">(Feb 22 2021 at 15:18)</a>:</h4>
<p>I'm wondering if we want to introduce a query</p>



<a name="227281779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227281779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227281779">(Feb 22 2021 at 15:18)</a>:</h4>
<p>or just kind of "pack this into" MIR construction</p>



<a name="227282357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227282357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227282357">(Feb 22 2021 at 15:22)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/278509-t-compiler.2Fproject-unsafe-thir-refactor/topic/chatting/near/227281743">said</a>:</p>
<blockquote>
<p>I'd like to read a bit into how the THIR is constructed I guess</p>
</blockquote>
<p>You mean, how THIR consumers construct it, or how the construction itself is implemented?</p>



<a name="227282412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227282412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227282412">(Feb 22 2021 at 15:22)</a>:</h4>
<p>the former</p>



<a name="227282477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227282477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227282477">(Feb 22 2021 at 15:22)</a>:</h4>
<p>where is it :)</p>



<a name="227282598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227282598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227282598">(Feb 22 2021 at 15:23)</a>:</h4>
<p>Probably in <code>rustc_mir_build::build</code> I think</p>



<a name="227282729"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227282729" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227282729">(Feb 22 2021 at 15:24)</a>:</h4>
<p>yes</p>



<a name="227282824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227282824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227282824">(Feb 22 2021 at 15:25)</a>:</h4>
<p>I'm tracking along the code there</p>



<a name="227283070"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227283070" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227283070">(Feb 22 2021 at 15:26)</a>:</h4>
<p>Found <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir_build/build/struct.Builder.html#method.into_expr"><code>Builder::into_expr</code></a></p>



<a name="227283134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227283134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227283134">(Feb 22 2021 at 15:26)</a>:</h4>
<p>Which to me seems to define how the MIR builder recurses over/constructs the THIR</p>



<a name="227283266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227283266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227283266">(Feb 22 2021 at 15:27)</a>:</h4>
<p>heh</p>



<a name="227283290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227283290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227283290">(Feb 22 2021 at 15:28)</a>:</h4>
<p>it takes us quite a while to invoke mirror!</p>



<a name="227283364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227283364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227283364">(Feb 22 2021 at 15:28)</a>:</h4>
<p><a href="https://github.com/nikomatsakis/rust/blob/a118ee2c13cc96ceb27bd5030c1cca1052377604/compiler/rustc_mir_build/src/build/mod.rs#L947-L948">here</a></p>



<a name="227283509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227283509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227283509">(Feb 22 2021 at 15:28)</a>:</h4>
<p>I thought everything above is just setting up the MIR builder</p>



<a name="227283629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227283629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227283629">(Feb 22 2021 at 15:29)</a>:</h4>
<p>This line:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="bp">self</span><span class="p">.</span><span class="n">into</span><span class="p">(</span><span class="n">Place</span>::<span class="n">return_place</span><span class="p">(),</span><span class="w"> </span><span class="n">block</span><span class="p">,</span><span class="w"> </span><span class="n">body</span><span class="p">)</span><span class="w"></span>
</code></pre></div>
<p>calls <code>Builder::into_expr</code> in the end</p>



<a name="227283885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227283885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227283885">(Feb 22 2021 at 15:31)</a>:</h4>
<p>yeah</p>



<a name="227283888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227283888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227283888">(Feb 22 2021 at 15:31)</a>:</h4>
<p>so</p>



<a name="227283950"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227283950" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227283950">(Feb 22 2021 at 15:31)</a>:</h4>
<p><a href="https://github.com/nikomatsakis/rust/blob/a118ee2c13cc96ceb27bd5030c1cca1052377604/compiler/rustc_mir_build/src/thir/mod.rs#L406-L422">comment</a></p>



<a name="227284030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284030">(Feb 22 2021 at 15:32)</a>:</h4>
<p>there is basically a 2-phase thing, right? we convert HIR to THIR (<code>self.hir.mirror(...)</code>) and then thir to MIR</p>



<a name="227284126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284126">(Feb 22 2021 at 15:32)</a>:</h4>
<p>but it does appear that basically everything before is irrelevant to THIR construction</p>



<a name="227284181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284181">(Feb 22 2021 at 15:32)</a>:</h4>
<p>after all, <code>let body = self.hir.mirror(ast_body);</code> -- only depends on <code>self.hir</code> and <code>ast_body</code></p>



<a name="227284225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284225">(Feb 22 2021 at 15:33)</a>:</h4>
<p>That only mirrors one layer?</p>



<a name="227284249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284249">(Feb 22 2021 at 15:33)</a>:</h4>
<p>I think that's untrue</p>



<a name="227284263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284263">(Feb 22 2021 at 15:33)</a>:</h4>
<p>despite the comment</p>



<a name="227284275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284275">(Feb 22 2021 at 15:33)</a>:</h4>
<p>but regardless</p>



<a name="227284292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284292">(Feb 22 2021 at 15:33)</a>:</h4>
<p>it gives you everything you need to mirror other layers</p>



<a name="227284308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284308">(Feb 22 2021 at 15:33)</a>:</h4>
<p>(I sort of thought we stopped doing that?)</p>



<a name="227284355"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284355" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284355">(Feb 22 2021 at 15:33)</a>:</h4>
<p>regardless, if we are going to do multiple passes over the THIR...</p>



<a name="227284374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284374">(Feb 22 2021 at 15:33)</a>:</h4>
<p>hmm</p>



<a name="227284392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284392">(Feb 22 2021 at 15:33)</a>:</h4>
<p><em>so</em></p>



<a name="227284465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284465">(Feb 22 2021 at 15:34)</a>:</h4>
<p>we could implement the "unsafety check" as kind of an "inverse visitor"</p>



<a name="227284557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284557">(Feb 22 2021 at 15:34)</a>:</h4>
<p>i.e., as the THIR is lazilly traversed, whenever something is mirrored, say, it gives a callback to the unsafety check (and maybe other THIR-based checks later on)</p>



<a name="227284621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284621">(Feb 22 2021 at 15:35)</a>:</h4>
<p>however I'm not sure I like that</p>



<a name="227284690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284690">(Feb 22 2021 at 15:35)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/278509-t-compiler.2Fproject-unsafe-thir-refactor/topic/chatting/near/227284621">said</a>:</p>
<blockquote>
<p>however I'm not sure I like that</p>
</blockquote>
<p>Because we are going to build the entire THIR tree anyway?</p>



<a name="227284701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284701">(Feb 22 2021 at 15:35)</a>:</h4>
<p>no</p>



<a name="227284719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284719">(Feb 22 2021 at 15:35)</a>:</h4>
<p>rather because it relies on the <em>MIR build</em> to walk everything</p>



<a name="227284730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284730">(Feb 22 2021 at 15:35)</a>:</h4>
<p>but it's not obvious that MIR build would always want to do that</p>



<a name="227284761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284761">(Feb 22 2021 at 15:36)</a>:</h4>
<p>e.g., you could imagine an optimization where MIR build stops walking after a <code>return</code> statement</p>



<a name="227284799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284799">(Feb 22 2021 at 15:36)</a>:</h4>
<p>rather than generating dead code that will be stripped out later</p>



<a name="227284819"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284819" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284819">(Feb 22 2021 at 15:36)</a>:</h4>
<blockquote>
<p>rather because it relies on the MIR build to walk everything</p>
</blockquote>
<p>Does it? Sorry, I'm not sure I understand</p>



<a name="227284855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284855">(Feb 22 2021 at 15:36)</a>:</h4>
<p>so--</p>



<a name="227284866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284866">(Feb 22 2021 at 15:36)</a>:</h4>
<p><em>assuming</em> THIR construction is lazy</p>



<a name="227284915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284915">(Feb 22 2021 at 15:36)</a>:</h4>
<p>I thought we could only use <code>mirror</code> all the way down</p>



<a name="227284918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284918">(Feb 22 2021 at 15:36)</a>:</h4>
<p>the way it used to work was that you would get back a single layer, with "stubs" for the layers below</p>



<a name="227284946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284946">(Feb 22 2021 at 15:37)</a>:</h4>
<p>Right</p>



<a name="227284975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284975">(Feb 22 2021 at 15:37)</a>:</h4>
<p>so then you would match on the outer layer</p>



<a name="227284991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227284991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227284991">(Feb 22 2021 at 15:37)</a>:</h4>
<p>and recursively invoke <code>mirror</code> on those stubs</p>



<a name="227285257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285257">(Feb 22 2021 at 15:38)</a>:</h4>
<p>I'm reading into the code to see if this is what it still does</p>



<a name="227285316"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285316" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285316">(Feb 22 2021 at 15:39)</a>:</h4>
<p>actually, I think it is?</p>



<a name="227285367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285367">(Feb 22 2021 at 15:39)</a>:</h4>
<p>e.g., in <a href="https://github.com/nikomatsakis/rust/blob/a118ee2c13cc96ceb27bd5030c1cca1052377604/compiler/rustc_mir_build/src/thir/cx/expr.rs#L151-L156">this code</a> we convert a method-call...</p>



<a name="227285423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285423">(Feb 22 2021 at 15:39)</a>:</h4>
<p>...and for each sub-function we are invoking <a href="https://github.com/nikomatsakis/rust/blob/a118ee2c13cc96ceb27bd5030c1cca1052377604/compiler/rustc_mir_build/src/thir/cx/to_ref.rs#L10-L16"><code>to_ref</code></a>...</p>



<a name="227285539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285539">(Feb 22 2021 at 15:40)</a>:</h4>
<p>and <code>to_ref</code> just seems to <a href="https://github.com/nikomatsakis/rust/blob/a118ee2c13cc96ceb27bd5030c1cca1052377604/compiler/rustc_mir_build/src/thir/cx/to_ref.rs#L14-L15">embed a pointer to the HIR, but not recursively construct anything</a></p>



<a name="227285568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285568">(Feb 22 2021 at 15:40)</a>:</h4>
<p>do you agree, or am I missing something?</p>



<a name="227285607"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285607" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285607">(Feb 22 2021 at 15:40)</a>:</h4>
<p>ps I'm looking over the code you pasted in.</p>



<a name="227285613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285613">(Feb 22 2021 at 15:40)</a>:</h4>
<p>Yes, this is what I had understood too</p>



<a name="227285623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285623">(Feb 22 2021 at 15:40)</a>:</h4>
<p>OK, so</p>



<a name="227285636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285636">(Feb 22 2021 at 15:41)</a>:</h4>
<p>I would like to avoid constructing the THIR twice</p>



<a name="227285663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285663">(Feb 22 2021 at 15:41)</a>:</h4>
<p>so what I was saying is</p>



<a name="227285727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285727">(Feb 22 2021 at 15:41)</a>:</h4>
<p>you could <em>imagine</em> having a callback on the <code>mirror</code> or something</p>



<a name="227285754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285754">(Feb 22 2021 at 15:41)</a>:</h4>
<p>so that the "unsafety" check would be implemented by receiving these callbacks</p>



<a name="227285824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285824">(Feb 22 2021 at 15:42)</a>:</h4>
<p>like "we just mirrored this, figure out if it is unsafe"</p>



<a name="227285833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285833">(Feb 22 2021 at 15:42)</a>:</h4>
<p>Ah, I see</p>



<a name="227285867"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285867" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285867">(Feb 22 2021 at 15:42)</a>:</h4>
<p>And you didn't like it because unsafety checking then relies on MIR building</p>



<a name="227285868"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285868" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285868">(Feb 22 2021 at 15:42)</a>:</h4>
<p>but I don't like that because it implies that the MIR builder is required to mirror everything</p>



<a name="227285881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285881">(Feb 22 2021 at 15:42)</a>:</h4>
<p>and probably in some specific order</p>



<a name="227285891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285891">(Feb 22 2021 at 15:42)</a>:</h4>
<p>or else the code gets more complicated</p>



<a name="227285941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285941">(Feb 22 2021 at 15:42)</a>:</h4>
<p><span class="user-mention silent" data-user-id="255061">Léo Lanteri Thauvin</span> <a href="#narrow/stream/278509-t-compiler.2Fproject-unsafe-thir-refactor/topic/chatting/near/227285867">said</a>:</p>
<blockquote>
<p>And you didn't like it because unsafety checking then relies on MIR building</p>
</blockquote>
<p>yes, exactly</p>



<a name="227285949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285949">(Feb 22 2021 at 15:42)</a>:</h4>
<p>I understand now, thank you</p>



<a name="227285962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285962">(Feb 22 2021 at 15:43)</a>:</h4>
<p>I'm somewhat unconvinced that lazilly mirror is valuable</p>



<a name="227285993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227285993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227285993">(Feb 22 2021 at 15:43)</a>:</h4>
<p>at least on this granularity</p>



<a name="227286021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286021">(Feb 22 2021 at 15:43)</a>:</h4>
<p>I implemented it initially but I'm not sure why besides that I could :P</p>



<a name="227286066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286066">(Feb 22 2021 at 15:43)</a>:</h4>
<p>So you'd suggest to just have a query to construct the THIR?</p>



<a name="227286067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286067">(Feb 22 2021 at 15:43)</a>:</h4>
<p>the real reason: I think I was concerned about peak memory usage</p>



<a name="227286076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286076">(Feb 22 2021 at 15:43)</a>:</h4>
<p>which... you know ... is valid</p>



<a name="227286096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286096">(Feb 22 2021 at 15:43)</a>:</h4>
<p>well, I'm not super keen on a query</p>



<a name="227286153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286153">(Feb 22 2021 at 15:44)</a>:</h4>
<p>precisely because of peak memory usage</p>



<a name="227286173"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286173" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286173">(Feb 22 2021 at 15:44)</a>:</h4>
<p>Right</p>



<a name="227286194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286194">(Feb 22 2021 at 15:44)</a>:</h4>
<p>or if we did a query, I would want a "stealable" one</p>



<a name="227286213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286213">(Feb 22 2021 at 15:44)</a>:</h4>
<p>but what I <em>was</em> thinking is that we could</p>



<a name="227286234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286234">(Feb 22 2021 at 15:44)</a>:</h4>
<p>(a) remove the whole <code>ExprRef::Hir</code> business</p>



<a name="227286250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286250">(Feb 22 2021 at 15:44)</a>:</h4>
<p>and instead just convert to THIR eagerly</p>



<a name="227286277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286277">(Feb 22 2021 at 15:44)</a>:</h4>
<p>this would simplify the code overall, removing the need to recursively call <code>self.cx.mirror</code> during MIR construction</p>



<a name="227286655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286655">(Feb 22 2021 at 15:46)</a>:</h4>
<p>if we did that</p>



<a name="227286692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286692">(Feb 22 2021 at 15:47)</a>:</h4>
<p>then we could basically make MIR build do something like:</p>



<a name="227286752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286752">(Feb 22 2021 at 15:47)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">thir</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">cx</span><span class="p">.</span><span class="n">build_thir</span><span class="p">(</span><span class="n">body</span><span class="p">);</span><span class="w"></span>
<span class="n">unsafety_check</span><span class="p">(</span><span class="n">thir</span><span class="p">);</span><span class="w"></span>
<span class="kd">let</span><span class="w"> </span><span class="n">mir</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">mir_build</span><span class="p">(</span><span class="n">thir</span><span class="p">);</span><span class="w"></span>
</code></pre></div>



<a name="227286763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286763">(Feb 22 2021 at 15:47)</a>:</h4>
<p>and then drop the <code>thir</code> at the end</p>



<a name="227286790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286790">(Feb 22 2021 at 15:47)</a>:</h4>
<p>I suspect this would be sufficient to keep peak memory usage under control</p>



<a name="227286816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286816">(Feb 22 2021 at 15:47)</a>:</h4>
<p>it would also allow us (over time) to do more things on THIR</p>



<a name="227286830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286830">(Feb 22 2021 at 15:47)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/278509-t-compiler.2Fproject-unsafe-thir-refactor/topic/chatting/near/227286655">said</a>:</p>
<blockquote>
<p>if we did that</p>
</blockquote>
<p>Side note: it would also make <a href="https://github.com/rust-lang/compiler-team/issues/408">https://github.com/rust-lang/compiler-team/issues/408</a> much easier to implement <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="227286886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286886">(Feb 22 2021 at 15:48)</a>:</h4>
<p>yeah:)</p>



<a name="227286914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286914">(Feb 22 2021 at 15:48)</a>:</h4>
<p>I think THIR is a really useful representation point</p>



<a name="227286939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286939">(Feb 22 2021 at 15:48)</a>:</h4>
<p>e.g., I suspect that const generics might like it too</p>



<a name="227286959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286959">(Feb 22 2021 at 15:48)</a>:</h4>
<p>(cc <span class="user-mention" data-user-id="216206">@lcnr</span> and <span class="user-mention" data-user-id="124288">@oli</span>)</p>



<a name="227286967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286967">(Feb 22 2021 at 15:48)</a>:</h4>
<p>but one thing at a time</p>



<a name="227286980"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286980" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286980">(Feb 22 2021 at 15:48)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> <a href="#narrow/stream/278509-t-compiler.2Fproject-unsafe-thir-refactor/topic/chatting/near/227286234">said</a>:</p>
<blockquote>
<p>(a) remove the whole <code>ExprRef::Hir</code> business</p>
</blockquote>
<p>this would make a good PR on its own</p>



<a name="227286999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227286999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227286999">(Feb 22 2021 at 15:48)</a>:</h4>
<p>btw</p>



<a name="227287015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227287015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227287015">(Feb 22 2021 at 15:48)</a>:</h4>
<p>I'm going to create a repository to track this stuff</p>



<a name="227287016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227287016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227287016">(Feb 22 2021 at 15:48)</a>:</h4>
<p>I can totally do it</p>



<a name="227287044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227287044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227287044">(Feb 22 2021 at 15:49)</a>:</h4>
<p>(like, right now)</p>



<a name="227287075"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227287075" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227287075">(Feb 22 2021 at 15:49)</a>:</h4>
<p>Does that deserve a MCP of its own?</p>



<a name="227287083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227287083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227287083">(Feb 22 2021 at 15:49)</a>:</h4>
<p>hmm</p>



<a name="227287103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227287103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227287103">(Feb 22 2021 at 15:49)</a>:</h4>
<p>yeah</p>



<a name="227287113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227287113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227287113">(Feb 22 2021 at 15:49)</a>:</h4>
<p>if you want to write it, I'll just second it right now</p>



<a name="227287125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227287125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227287125">(Feb 22 2021 at 15:49)</a>:</h4>
<p>but that'll give folks a chance to comment</p>



<a name="227287152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227287152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227287152">(Feb 22 2021 at 15:49)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="227287157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227287157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227287157">(Feb 22 2021 at 15:49)</a>:</h4>
<p>I kind of felt it was "part of" the original one, but you're right that it's worth calling out</p>



<a name="227287186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227287186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227287186">(Feb 22 2021 at 15:49)</a>:</h4>
<p>I'll write it with elements from this topic</p>



<a name="227287418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227287418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227287418">(Feb 22 2021 at 15:51)</a>:</h4>
<p>perfect, thank you!</p>



<a name="227289247"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227289247" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227289247">(Feb 22 2021 at 16:01)</a>:</h4>
<p>Just one doubt: you don't need to build a THIR tree to perform analysis on patterns, right?</p>



<a name="227289313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227289313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227289313">(Feb 22 2021 at 16:01)</a>:</h4>
<p>I don't know how that code works</p>



<a name="227289352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227289352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227289352">(Feb 22 2021 at 16:01)</a>:</h4>
<p>Pattern checks only build the patterns they check?</p>



<a name="227289356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227289356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227289356">(Feb 22 2021 at 16:01)</a>:</h4>
<p>but I guess it would benefit from this too..?</p>



<a name="227289391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227289391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227289391">(Feb 22 2021 at 16:01)</a>:</h4>
<p>are we building the patterns twice?</p>



<a name="227289456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227289456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227289456">(Feb 22 2021 at 16:01)</a>:</h4>
<p>I think so</p>



<a name="227289525"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227289525" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227289525">(Feb 22 2021 at 16:02)</a>:</h4>
<p>this <em>may</em> be an argument to create a query with stealable stuff</p>



<a name="227289626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227289626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227289626">(Feb 22 2021 at 16:02)</a>:</h4>
<p>I'm not sure if pattern check is a query today that returns useful info?</p>



<a name="227289665"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227289665" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227289665">(Feb 22 2021 at 16:02)</a>:</h4>
<p>IIUC, match checking works by recursing over the HIR and only building THIR patterns</p>



<a name="227290670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227290670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227290670">(Feb 22 2021 at 16:06)</a>:</h4>
<p>well</p>



<a name="227290691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227290691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227290691">(Feb 22 2021 at 16:06)</a>:</h4>
<p>I'd probably refactor that as a follow-up</p>



<a name="227290766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227290766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227290766">(Feb 22 2021 at 16:06)</a>:</h4>
<p>that'd be a good thing to call out in the MCP and get feedback</p>



<a name="227291511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/278509-project-thir-unsafeck/topic/chatting/near/227291511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Léo Lanteri Thauvin <a href="https://rust-lang.github.io/zulip_archive/stream/278509-project-thir-unsafeck/topic/chatting.html#227291511">(Feb 22 2021 at 16:10)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> <a href="https://github.com/rust-lang/compiler-team/issues/409">https://github.com/rust-lang/compiler-team/issues/409</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>